<template>
  <el-dialog title="其他信息" :visible.sync="dialogFormVisible">
    <div style="margin-bottom: 20px">
      <span style="font-weight: bold">邮箱：</span>
      <span v-if="comment.email===''||comment.email===undefined||comment.email===null">无</span>
      <span v-else>{{ comment.email }}</span>
    </div>
    <div style="margin-bottom: 20px">
      <span style="font-weight: bold">IP地址：</span>
      <span>{{ comment.ip }}</span>
    </div>
    <div style="margin-bottom: 20px">
      <span style="font-weight: bold">管理员评论：</span>
      <span v-if="comment.isAdminComment===true">是</span>
      <span v-else>否</span>
    </div>
    <div style="margin-bottom: 20px">
      <span style="font-weight: bold">个人站点：</span>
      <span v-if="comment.website===''||comment.website===undefined||comment.website===null">无</span>
      <span v-else>{{ comment.website }}</span>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "CommentInfo",
  data() {
    return {
      dialogFormVisible: false,
      comment: {
        email: '',
        ip: '',
        isAdminComment: false,
        website: ''
      }
    }
  },
  methods: {
    init(id) {
      this.dialogFormVisible = true;
      // dom元素更新后执行
      this.$nextTick(() => {
            this.$http({
              url: `/comment/info/${id}`,
              method: 'get',
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.comment = data.data;
              }
            })
          }
      )
    },
  }
}
</script>

<style scoped>

</style>
